<template>
  <div class="supplier-box" v-if="$props.detail.id>0" style="width: 410px; margin: 3px; background: #f1f1f1; height: 110px;" :style="{float:isList?'left':''}">
    <div class="logo" @click="$router.push('SupplierProductSearchPage?supplierId='+$props.detail.id)">
      <img :src="$props.detail.logo" alt="">
      <el-button type="success" v-show="isList">前往店铺</el-button>
    </div>
    <div class="right-info" style="width: 330px">
      <div class="line1">
        <span class="name" v-text="$props.detail.name"></span>
        <span class="is-same-city-send-tag" v-if="$props.detail.isSameCitySend===1">同城配送</span>
        <div class="chat-button" @click="contactSupplier"><i class="iconfont icon-kefu"></i> 联系供应商</div>
      </div>
      <div class="line2">
        <div class="item">
          营业状态:
          <el-tag @click="showNotice" class="business-status-0" v-text="$props.detail.businessStatus.name"></el-tag>
        </div>
        <div class="item">
          营业时间: <span class="business-status-0" v-text="$props.detail.businessTime.join(',')"></span>
        </div>
      </div>
      <div class="line3">
        店铺位置: <span class="address-detail ovd_s" style="display: inline-block;" v-text="$props.detail.addressDetail"></span>
      </div>
    </div>
    <div class="c"></div>
  </div>
</template>

<script>
export default {
  name: 'SupplierBox',
  props:{
    detail:Object,
    isList:Boolean
  },
  methods:{
    contactSupplier:function () {
      let $this=this
      $this.MyRequest($this.ApiDoNameShop + 'Home/checkAndGetMessageSession', {toUserType:'Supplier',toMainId:this.$props.detail.id}, function (data) {
        // console.log(data)
        $this.$router.push({
          name:'ChatPage',
          query:{
            sessionId:data.id
          }
        })
        // $this.dialogVisible = true
        // $this.$forceUpdate()
      }, function (res) {
        $this.$message.error(res.message)
        $this.loading = false
      })
    },
    showNotice:function () {
      let $this=this
      if ($this.$props.detail.businessStatus.id===2 && ($this.$props.detail.businessStopInfo && $this.$props.detail.businessStopInfo.length>0)){
        $this.$msgbox({
          title: '停业公告',
          message: $this.$props.detail.businessStopInfo,
          showConfirmButton: false
        })
      }
      console.log($this.$props.detail.businessStatus)
    }
  }
}
</script>

<style scoped>

</style>
